| TCP/IP | OSI |
|---|---|
| TCP refers to Transmission Control Protocol. | OSI refers to Open Systems Interconnection. |
| TCP/IP has 4 layers. | OSI has 7 layers. |
| TCP/IP is more reliable | OSI is less reliable |
| TCP/IP does not have very strict boundaries. | OSI has strict boundaries |
| TCP/IP follow a horizontal approach. | OSI follows a vertical approach. |
| TCP/IP uses both session and presentation layer in the application layer itself. | OSI uses different session and presentation layers. |
| TCP/IP developed protocols then model. | OSI developed model then protocol. |
Transmission Delay = Data size / bandwidth = (L/B) second
Propagation delay = distance/transmission speed = d/s
Average Queuing delay = (N-1)L/(2*R)
where N = no. of packets
L=size of packet
R=bandwidth
Total time or End-to-End time
= Transmission delay + Propagation delay+ Queuing delay
+ Processing delay
Total delay
= M*(Transmission delay + propagation delay)+
(M-1)*(Processing delay + Queuing delay) +
(N-1)*(Transmission delay)
Propagation Delay = (Distance between routers) / (Velocity of propagation)
= Tt(data) + Tp(data) + Tq + Tpro + Tt(ack) + Tp(ack)
Since,
Tp(ack) = Tp(data)
And,
Tt(ack) << Tt(data).
So we can neglect Tt(ack)
Tq = 0 and Tpro = 0
Hence,
Total time = Tt(data) + 2 * Tp
Tt(data) : Transmission delay for Data packet
Tp(data) : propagation delay for Data packet
Tq: Queuing delay
Tpro: Processing delay
Tt(ack): Transmission delay for acknowledgment
Tp(ack) : Propagation delay for acknowledgment
= Useful time / Total cycle time.
= Tt / (Tt + 2*Tp)
= 1 / (1+2*(Tp/Tt))
= 1 / (1+2*a)
where,
a = Tp / Tt
Throughput,
= L/(Tt + 2*Tp)
= ((L/BW)*BW)/(Tt + 2*Tp)
= Tt/(Tt + 2*Tp) * BW
= 1/(1 + 2a) * BW
Hence, Throughput
= η * BW
where,
BW : BandWidth
L : Size of Data packet
n = 1/(1 + 2*(Tp/Tt)
= 1/(1 + 2*(d/v)*(BW/L))
where,
d = distance between source and receiver
v = velocity
Tt = 1ms
Tp = 2ms
Bandwidth = 6 Mbps
Efficiency(η)
= 1/(1 + a)
= 1/(1 + (2/1))
= 1/3
= 33.33 %
Throughput
= η * BW
= (1/3) * 6
= 2 Mbps
Tt = D/B
Tp = d/s
Total cycle time = Tt(data) + Tp(data) +Since acknowledgements are very less in size, their transmission delay can be neglected.
Tt(acknowledgement) + Tp(acknowledgement)
= Tt(data) + Tp(data) + Tp(acknowledgement)
= Tt + 2*Tp
Efficiency = Useful Time / Total Cycle Time
= Tt/(Tt + 2*Tp) (For Stop and Wait)
= 1/(1+2a) [ Using a = Tp/Tt ]
EB = Data Size(L) / Total Cycle time(Tt + 2*Tp)
Multiplying and dividing by Bandwidth (B),
= (1/(1+2a)) * B [ Using a = Tp/Tt ]
= Efficiency * Bandwidth
Capacity = Bandwidth(B) * Propagation(Tp)
For Full Duplex channels,
Capacity = 2*Bandwidth(B) * Propagation(Tp)
In Tt units ----> 1 packet is Transmitted.
In 1 units ----> 1/Tt packet can be Transmitted.
In Tt + 2*Tp units -----> (Tt + 2*Tp)/Tt
packets can be Transmitted
------> 1 + 2a [Using a = Tp/Tt]
Efficiency = N/(1+2a)
Where a = Propagation delay / Transmission delay
Buffers = N + N
Sequence number = N(sender side) + N ( Receiver Side)
| Properties | Stop and Wait | Go Back N | Selective Repeat |
|---|---|---|---|
| Sender window size | 1 | N | N |
| Receiver Window size | 1 | 1 | N |
| Minimum Sequence number | 2 | N+1 | 2N |
| Efficiency | 1/(1+2*a) | N/(1+2*a) | N/(1+2*a) |
| Type of Acknowledgement | Individual | Cumulative | Individual |
| Supported order at Receiving end | - | In-order delivery only | Out-of-order delivery as well |
| Number of retransmissions in case of packet drop | 1 | N | 1 |
A---R1---R2---B
A is the sender (start)
R1, R2 are two routers that store and forward data
B is receiver(destination)
Parity Check
Parity check works by counting the no. of 1s in the bit-representation and then appending 1 in case there exists odd no. of ones, or 0 in case of even no. of 1s. Thus, the total no. of 1s become even. Hence, this scheme is also called even-parity check. Thus, if due to error any bit changes, the total no. of 1s will become odd.2D Parity Check
Parity check bits are calculated for each row, which is equivalent to a simple parity check bit. Parity check bits are also calculated for all columns, then both are sent along with the data. At the receiving end these are compared with the parity bits calculated on the received data.Checksum
The procedure for usage of checksum is as follows:CRC (Cyclic Redundancy Check)
CRC is based on binary division, and it works as:Network Address and Mask
Network address - It identifies a network on internet. Using this, we can find range of addresses in the network and total possible number of hosts in the network.
Mask - It is a 32-bit binary number that gives the network address in the address block when AND operation is bitwise applied on the mask and any IP address of the block.
The default mask in different classes are :
Class A - 255.0.0.0
Class B - 255.255.0.0
Class C - 255.255.255.0
Example : Given IP address 132.6.17.85 and default class B mask, find the beginning address (network address).
Solution : The default mask is 255.255.0.0, which means that the only the first 2 bytes are preserved and the other 2 bytes are set to 0. Therefore, the network address is 132.6.0.0.
Some values calculated in subnetting :
1. Number of subnets : Given bits for mask - No. of bits in default mask
2. Subnet address : AND result of subnet mask and the given IP address
3. Broadcast address : By putting the host bits as 1 and retaining the network bits as in the IP address
4. Number of hosts per subnet : 2(32 - Given bits for mask) - 2
5. First Host ID : Subnet address + 1 (adding one to the binary representation of the subnet address)
6. Last Host ID : Subnet address + Number of Hosts
Example : Given IP Address - 172.16.0.0/25, find the number of subnets and the number of hosts per subnet. Also, for the first subnet block, find the subnet address, first host ID, last host ID and broadcast address.
Solution : This is a class B address. So, no. of subnets = 2(25-16) = 29 = 512.
No. of hosts per subnet = 2(32-25) - 2 = 27 - 2 = 128 - 2 = 126
For the first subnet block, we have subnet address = 0.0, first host id = 0.1, last host id = 0.126 and broadcast address = 0.127
If IP address = 193.1.2.129 (convert it into binary form)Hence, this IP address belongs to subnet:3 which has Nid = 193.1.2.128
= 11000001.00000001.00000010.10000001
Subnet mask = 11111111.11111111.11111111.11000000
Bit Wise AND = 11000001.00000001.00000010.10000000
Therefore, Nid = 193.1.2.128
If IP address = 193.1.2.67 (convert it into binary form)Hence, this IP address belongs to subnet:2 which has Nid = 193.1.2.64
= 11000001.00000001.00000010.01000011
Subnet Mask = 11111111.11111111.11111111.11000000
Bit Wise AND = 11000001.00000001.00000010.01000000
Therefore, Nid = 193.1.2.64
193.1.2.0 to 193.1.2.127
193.1.2.128 to 193.1.2.255
Subnet-1: 193.1.2.0 to 193.1.2.63
Subnet-2: 193.1.2.64 to 193.1.2.127
Subnet-3: 193.1.2.128 to 193.1.2.191
Subnet-4: 193.1.2.192 to 193.1.2.255
24 bits in network id + 2 bits in subnet id = 26 (1's) and
6 bits in host id = 6 (0's)
Subnet Mask = 11111111.11111111.11111111.11000000
= 255.255.255.192
Network Id for S1: 200.1.2.0Hence, we can say that Network size will also decrease. We can't use our Network completely.
Broadcast address of S1: 200.1.2.63
Network Id for S2: 200.1.2.64
Broadcast address of S2: 200.1.2.127
Network Id for S3: 200.1.2.128
Broadcast address of S3: 200.1.2.191
Network Id for S4: 200.1.2.192
Direct Broadcast address of S4: 200.1.2.255
Class A network contains 224 Hosts,
Class B network contains 216 Hosts,
Class C network contains 28 Hosts
a . b . c . d / nWhere, n is number of bits that are present in Block Id / Network Id.
20.10.50.100/20
N1: 200.1.0.0/24We see that all the addresses are contiguous. N1 ranges from 200.1.0.0 to 200.1.0.255. Adding 0.0.0.1 to the last address yields 200.1.1.0, which is the start address of N2. Similarly, for all the subsequent networks N2, N3 & N4.
N2: 200.1.1.0/24
N3: 200.1.2.0/24
N4: 200.1.3.0/24
| IPv4 | IPv6 |
|---|---|
| IPv4 has 32-bit address length | IPv6 has 128-bit address length |
| It Supports Manual and DHCP address configuration | It supports Auto and renumbering address configuration |
| In IPv4 end to end connection integrity is Unachievable | In IPv6 end to end connection integrity is Achievable |
| It can generate 4.29x109 address space | Address space of IPv6 is quite large it can produce 3.4x1038 address space |
| Security feature is dependent on application | IPSEC is inbuilt security feature in the IPv6 protocol |
| Address representation of IPv4 in decimal | Address Representation of IPv6 is in hexadecimal |
| Fragmentation performed by Sender and forwarding routers | In IPv6 fragmentation performed only by sender |
| In IPv4 Packet flow identification is not available | In IPv6 packetflow identification are Available and uses flow label field in the header |
| In IPv4 checksumfield is available | In IPv6 checksumfield is not available |
| It has broadcast Message Transmission Scheme | In IPv6 multicast and any cast message transmission scheme is available |
| In IPv4 Encryption and Authentication facility not provided | In IPv6 Encryption and Authentication are provided |
| Transmission control protocol (TCP) | User datagram protocol (UDP) |
|---|---|
| TCP is a connection-oriented protocol. Connection-orientation means that the communicating devices should establish a connection before transmitting data and should close the connection after transmitting the data. | UDP is the Datagram oriented protocol. This is because there is no overhead for opening a connection, maintaining a connection, and terminating a connection. UDP is efficient for broadcast and multicast type of network transmission. |
| TCP is reliable as it guarantees delivery of data to the destination router. | The delivery of data to the destination cannot be guaranteed in UDP. |
| TCP provides extensive error checking mechanisms. It is because it provides flow control and acknowledgment of data. | UDP has only the basic error checking mechanism using checksums. |
| Sequencing of data is a feature of Transmission Control Protocol (TCP). this means that packets arrive in-order at the receiver. | There is no sequencing of data in UDP. If ordering is required, it has to be managed by the application layer. |
| TCP is comparatively slower than UDP. | UDP is faster, simpler and more efficient than TCP. |
| Retransmission of lost packets is possible in TCP, but not in UDP. | There is no retransmission of lost packets in User Datagram Protocol (UDP). |
| TCP header size is 20 bytes. | UDP Header size is 8 bytes. |
| TCP is heavy-weight. | UDP is lightweight. |
| TCP is used by HTTP, HTTPs, FTP, SMTP and Telnet | UDP is used by DNS, DHCP, TFTP, SNMP, RIP, and VoIP. |
R3(config)#ip route 192.168.10.0 255.255.255.0 172.16.10.2
R3(config)#ip route 192.168.20.0 255.255.255.0 172.16.10.6
R2(config)#ip route 192.168.20.0 255.255.255.0 172.16.10.1Similarly for R1:
R2(config)#ip route 10.10.10.0 255.255.255.0 172.16.10.1
R2(config)#ip route 172.16.10.4 255.255.255.0 172.16.10.1
R1(config)#ip route 192.168.10.0 255.255.255.0 172.16.10.5
R1(config)#ip route 10.10.10.0 255.255.255.0 172.16.10.5
R1(config)#ip route 172.16.10.0 255.255.255.0 172.16.10.5
R1(config)#ip route 0.0.0.0 0.0.0.0 172.16.10.5Now configuring default routing for R2:
R2(config)#ip route 0.0.0.0 0.0.0.0 172.16.10.1
Information kept by DV router -
Dx(y) = Estimate of least cost from x to y
C(x,v) = Node x knows cost to each neighbor v
Dx = [Dx(y): y ∈ N ] = Node x maintains distance vector
Node x also maintains its neighbors' distance vectors
– For each neighbor v, x maintains Dv = [Dv(y): y ∈ N ]
Dx(y) = min { C(x,v) + Dv(y)} for each node y ∈ N
Dx(y) = min { C(x,v) + Dv(y)} for each node y ∈ N
Entering the URL
We use browsers to surf the internet (Chrome, Firefox, Edge, etc.). Each of them has an address-bar at the top where we provide the URL of the website we want to visit -DNS Lookup
DNS calls are an extra overhead which serves us no good in loading the actual website. Thus, it would be very beneficial if we can cache DNS IP values for frequently visited websites in the user-system itself. Thus, comes the concept of DNS caching. Before making a call to the actual DNS server, the browser looks up the DNS cache of the system. The DNS cache looks as -DNS Resolution
We shall understand this with an example. Say we search www.youtube.com. DNS resolution occurs from end to start of the address. i.e. for our query, com -> youtube -> www . THe DNS resolver first requests the root-DNS with com as the search query.TCP Connection & HTTP Request
Establishing a TCP connection is a 3-way handshake process which is described in the figure shown below -Website & Resource Delivery
After client and server are successfully connected via a secure TCP connection, browser issues an HTTP Request to the server demanding it to serve the page requested by the user. The server responds with an HTTP Response (the HTML page containing images, links to videos and other relevant data ~ JSON data perhaps) back to the client. The browser application then renders the source files received onto the user screen as a webpage.Sub-URL Resolution
What happens when we access, say geeksforgeeks.org/data-strucure-and-algorithms/ or geeksforgeeks.org/users/The DHCP protocol gives the network administrator a method to configure the network from a centralised area.
With the help of DHCP, easy handling of new users and reuse of IP address can be achieved.